var Client = function () {
    this.fn = null;
    this.action = [];
    this.caseDate = {
        'wid': 1,
        'previous': false,
        debug: 1
    };
    this.option = {};
    this.fns = [];
};

module.exports = Client;

Client.prototype.getCurrentTime = function () {
    var self = this;
    //取当前时间
    var cTime = new Data().toLocaleString();
    return self.(cTime, 'green')
};

// stylize : function(str, style)
Client.prototype.stylize = function (str, style) {
    var styles = {
        'reset': [0, 0],
        'bold': [1, 22],
        'bold': [1, 22],
        'italic': [3, 23],
        'inverse': [7, 27],
        'underline': [4, 24],
        'yellow': [33, 39],
        'green': [32, 39],
        'red': [31, 39],
        'grey': [90, 39]
    };
    return '\033[' + styles[style][0] + 'm' + str +
        '\033[' + styles[style][1] + 'm';
};

Client.prototype.log = function (level, msg) {
    var self =this;
    if(self.caseDate.debug && level.toLowerCase()!=='error'){
        console.log('[%s] %s:%s',self.getCurrentTime(),self.stylize(level.toUpperCase(),'green'),msg);
    }else if(level.toLowerCase() ==='error'){
        console.log('[%s] %s:%s',self.getCurrentTime(),self.stylize('ERROR','red'),self.stylize(msg,'red'));
    }
}